var o;
avalon.ready(function(){
	o = avalon.define({
		$id:"root",
		register:false,
        codenumber:false,
//      notice:false,
		wangji:false,
		shouquan:false,
        setpw:false,
        login:false,
        isaccede:false,
        useerror:true,
        kind:0,  //0为注册，默认为注册
		/*立即注册弹框*/
        OpenRegister:function(){
        	o.register = true; 
        },
        /*打开验证码弹框*/
        OpenCode:function(){
        	o.register = false;
        	o.codenumber = true;
        	o.kind=0;
        },
        /*登录弹框*/
        OpenLogin:function(){
        	o.login = true;
        	o.kind=1;   //数字为1代表是登录点过去的
        },
        /*忘记密码弹框*/
        forgetpass:function(){
        	o.login = false;
        	o.wangji = true;
        	o.codenumber = true;
        },
        /*验证码弹框过渡到设置密码弹框*/
        OpenNotice:function(){
        	if(o.kind==0&&o.isaccede){
    			o.codenumber = false;
        		o.setpw = true;
        	}else if(o.kind==0&&!o.isaccede){
        		o.shouquan = true
        		return false;
        	}else if(o.kind==1&&o.wangji){
        		o.codenumber = false;
				o.setpw = true;
			}else if(o.kind==1&&!o.wangji){
				o.codenumber = false;
				location.href="../products/order_list.html";  //跳转至指定的页面
			}
        },
        /*是否勾选注册协议*/
        ChooseAccede:function(){
        	o.isaccede = !o.isaccede;
        },
        
        toChicang:function(){
        	o.setpw = false;
        	location.href="../products/order_list.html";  //跳转至指定的页面
        },
//      OpenSetpw:function(){
//      	o.notice = false;
//      	o.setpw = true;
//      },
        /*关闭弹框*/
        closepop:function(){
        	o.register = false;
        	o.codenumber = false;
//      	o.notice = false;
        	o.setpw = false;
        	o.login = false;
        }
	});
	avalon.scan(document.body);
})